'''
	赋值运算符
	1. 等于号
	2. 运算赋值
'''


# 1. 等于号
# ----------------------------------------
# 	1.1 单一赋值
# 	1.2 连续赋值
# 	1.3 多段赋值
# 	1.4 剩余赋值

# 1.1 单一赋值
a = 10

# 1.2 连续赋值
a = b = c = 20

print(a, b, c)
print(id(a))
print(id(b))
print(id(c))


# 1.3 多段赋值 ( 重点 )
a,b,c = 1,2,3
print(a, b, c)
print(id(a))
print(id(b))
print(id(c))


a,b = 5,10
a,b = b, a+b  # a,b = 10, 15
# 先算 = 右边的, 再算 = 左边的
print(a, b)


# 技巧: 交换变量
a = 5
b = 10

a,b = b,a
# 省略的临时内存


a = 5
b = 10

c = a
a = b
b = c
print('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~')


# 1.4 剩余赋值
a,b,*c = 1,2,3,4,5,6,67,7
print( a, b )
print( c )  	# *c 将剩下来的没人要的数据 全部接收, 以 list 形式接收
print('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~')



# 2. 运算赋值
# ----------------------------------------
# 	+=  -=  *=  /=  %=  //=  **=

a = 5
b = 10
a += b 		# a = a + b  ===>  a = 5 + 10,   b 没有任何变化
print(a, b) 



a = 5
b = 10
a *= b 		# a = a * b  ===>  a = 5 * 10,   b 没有任何变化
print(a, b) 



a = 10
b = 3
a **= b 		# a = a ** b  ===>  a = 10 ** 3,   b 没有任何变化
print(a, b) 



